package metalink.admin;
import com.opensymphony.xwork2.ActionSupport;
import java.util.*;
import java.sql.*;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import vo.*;
import vo.mixed.*;
import model.admin.*;
import myutil.*;


public class ReplyToEventRequest extends ActionSupport{
	int event_id;
	public int getEvent_id() {
		return event_id;
	}
	public void setEvent_id(int event_id) {
		this.event_id = event_id;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	String status;
public String execute(){
	try {
		HttpSession session = ServletActionContext.getRequest().getSession();
		String username = session.getAttribute("username").toString();
		Connect c=new Connect();
		if(status.equals("coming")){
			c.dml("update event_participation set coming=1 where event_id='"+event_id+"' and participant_id='"+username+"'");
		}
		else if(status.equals("notcoming")){
			c.dml("update event_participation set notcoming=1 where event_id='"+event_id+"' and participant_id='"+username+"'");
		}
		else if(status.equals("maybe")){
			c.dml("update event_participation set maybe=1 where event_id='"+event_id+"' and participant_id='"+username+"'");
		}
		return SUCCESS;
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
		return ERROR;
	}
}
}
